1. Technical Field
Embodiments described herein generally relate to processors. In particular, embodiments described herein generally relate to performing cryptography in processors.
2. Background Information
Cryptology is a technology often used to protect confidential or secret information in computer systems and other electronic devices. Cryptology generally involves using a cryptographic algorithm and a cryptographic key to protect the information. For example, encryption (sometimes referred to as cipher) may be performed in which a series of transformations or operations as specified by the cryptographic algorithm are performed on unencrypted or plaintext input data (e.g., a string of bits representing text, numbers, intelligible characters, etc.) using an encryption key (e.g., a string of bits) to produce encrypted data. The encrypted data is also sometimes referred to as cipher text or cipher data. The encrypted data is generally unintelligible. It is generally not possible, or at least not practically feasible, to determine the unencrypted plaintext data from the encrypted data, without knowing the cryptographic key. If the cryptographic key is known, decryption (sometimes referred to as inverse cipher) may be performed on the encrypted data to reproduce the corresponding plaintext or unencrypted data. The transformations or operations performed during decryption may be substantially the reverse of those performed during encryption.
SM4 is a cryptographic algorithm approved by the Chinese government for use in wireless networks. SM4 was formerly known as SMS4. The SM4 cryptographic algorithm is a block cipher algorithm. The input data (also referred to as state), output data, and cryptographic key are each 128-bits. Encryption of data is performed through thirty-two rounds. Each round involves a number of different operations or transformations that are used to transform the input data into the encrypted data. Thirty-two rounds with similar transformations are used to decrypt data. There are also thirty-two rounds for key expansion in which round keys for the different encryption and decryption rounds are generated. Further details of the SM4 cryptographic algorithm, if desired, are available in the document “SM4Encryption Algorithm for Wireless Networks,” translated and typeset by Whitfield Diffie of SUN MICROSYSTEMS Corporation and George Ledin of Sonoma State University, 15 May 2008, Version 1.03.
One challenge is that implementing the SM4 cryptographic algorithm generally tends to be computationally intensive. As a result, software implementations of the SM4 cryptographic algorithm generally tend to have poor performance. This poor performance is due at least in part to the large number of operations that need to be performed, and the correspondingly large number of instructions that need to be executed. Commonly, each single round may take from several to many instructions. Moreover, recall that thirty-two rounds are needed for each of encryption, decryption, and key expansion.